#pragma once

#include "PhysicObject.h"
#include "PhysicCollisionDetection.h"
#include "PhysicCollisionResolution.h"

/*
Go to PhysicObject.h for more info about 
Physic Object and Physic Rigid Body.
*/

// Physic System class
class PhysicSystem{
private:
	// This is the Physic System's list of Rigid Bodies
	LinkedList<PhysicRigidBody *> m_RigidBodyList;

	// These Classes and Objects were created to separate the functionality
	// of the Physic System. Mainly for organization.
	PhysicCollisionDetection m_PhysicCollisionDetection;
	PhysicCollisionResolution m_PhysicCollisionResolution;

public:
	PhysicSystem();
	~PhysicSystem();

	// This function is used to itialize the Physic System. It currently
	// doesn't do anything. 
	int Initialize();

	// This function will update every Physic Objects that are part of this 
	// Physic System. This will update the position, velocity, and handle
	// collision of the Physic Object
	int Update(float a_timePassed);

	// This function is use to release the memory that the Physic System may be
	// using. It does not release or clear out the memory used by a Physic Object.
	void Release();

	// This function is used to "create" or "add" the Physic Object to the 
	// Physic System. Objects that are not part of the Physic System will 
	// not have physics according the Physic System. The Physic System will 
	// create it's own Rigid Body object for the Physic Object. This Rigid Body
	// is then added to the Rigid Body List for updating.
	void Create(PhysicObject *a_PhysicObject);

	// This function is used to "destroy" or "remove" the Physic Object 
	// from the Physic System. Onjects that are not part of the Physic 
	// System will no longer act according to the Physic System's will. ...beware the Physic System. It will devou... r. y ou  rs...oul!
	// The Physic System will then remove the Rigid Body was created by the
	// Physic Object. 
	void Destroy(PhysicObject *a_PhysicObject);

};